#ifndef CLINE3D_H_
#define CLINE3D_H_

#include "cvector3d.h"
#include "../exception/clinenotexistexception.h"

/**
 * CLine3D - 3D line in three dimensional space
 * @author Michal Rost
 * @date 20.06.2007
 */
template <typename T>
class CLine3D : public CObject {
public:
  CLine3D();
  CLine3D(const CLine3D<T> &l);
  CLine3D(const CVector3D<T> &p1, const CVector3D<T> &p2);
  bool operator == (const CLine3D<T> &l) const;
  bool operator != (const CLine3D<T> &l) const;
  void set(const CVector3D<T> &p, const CVector3D<T> &direction);
  CVector3D<T> getDirection() const;
  CVector3D<T> getPoint() const;
  CLine3D<T> lineBetween(const CLine3D<T> &l) const;
  T pointDist(const CVector3D<T> &p) const;
  T lineDist(const CLine3D<T> &l) const;
  bool isPointOnLine(const CVector3D<T> &p) const;
  bool isParalell(const CLine3D<T> &l) const;
  bool isIntersecting(const CLine3D<T> &l, T epsilon) const;
  bool isIntersecting(const CLine3D<T> &l) const;
  static string getClassName() {
    static const string CLASS_NAME = "CLine3D";
    return CLASS_NAME;
  }
protected:
  CVector3D<T> point;
  CVector3D<T> direction;
  void copyFrom(const CLine3D<T> &l);
};

#endif
